﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="bas_role.aspx.cs" Inherits="bas_role" %>
<%@ Register Src="~/UserControls/ucFavorite.ascx" TagName="ucFavorite" TagPrefix="Kerry" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="FeaturedContent" runat="Server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="Server">
  <table class="ConditionTable">
    <tr>
      <th colspan="2"><Kerry:ucFavorite ID="ucFavorite" runat="server" />群組維護
      </th>
    </tr>
    <tr>
      <td>角色代號 :
                <asp:TextBox ID="txtROLE_ID" runat="server"></asp:TextBox>
      </td>
      <td>角色名稱：<asp:TextBox ID="txtROLE_NAME" runat="server"></asp:TextBox>
      </td>
    </tr>

    <tr>
      <td colspan="2">

        <asp:Button ID="btn_search" runat="server" Text="搜尋" OnClick="btnQuery_Click" />
        <asp:Button ID="btn_exit" runat="server" Text="離開" OnClick="btn_exit_Click" />
      </td>
    </tr>
  </table>
  <br />
  <asp:Label ID="lbl_Message" runat="server" Text="" ForeColor="Red"></asp:Label>
  <asp:ListView ID="DV1" runat="server" DataKeyNames="ROLE_ID" InsertItemPosition="LastItem" OnItemCanceling="DV1_ItemCanceling" OnItemEditing="DV1_ItemEditing" OnItemDeleting="DV1_ItemDeleting" OnItemInserting="DV1_ItemInserting" OnItemUpdating="DV1_ItemUpdating" OnPagePropertiesChanging="DV1_PagePropertiesChanging" OnPagePropertiesChanged="DV1_PagePropertiesChanged">

    <EditItemTemplate>
      <tr style="background-color: #FFCC66; color: #000080;">
        <td>
          <asp:Button ID="btn_save" runat="server" CommandName="Update" Text="存檔" ValidationGroup="EDIT" />
          <asp:Button ID="btn_cancel" runat="server" CommandName="Cancel" Text="取消" />
        </td>
        <td>
          <asp:Label ID="lblROLE_ID" runat="server" Text='<%# Eval("ROLE_ID") %>' />
          <asp:TextBox ID="txtROLE_ID_G" runat="server" Text='<%# Bind("ROLE_ID") %>' Visible="false" />
        </td>
        <td>
          <asp:TextBox ID="txtROLE_NAME_G" MaxLength="30" runat="server" Text='<%# Bind("ROLE_NAME") %>' />
          <asp:RequiredFieldValidator ID="RequiredFieldValidator1" ValidationGroup="EDIT" ControlToValidate="txtROLE_NAME_G" runat="server" SetFocusOnError="true" ErrorMessage="不可空白" ForeColor="Red"></asp:RequiredFieldValidator>

        </td>
        <td>
          <asp:TextBox ID="txtPARENT_ROLE_ID" MaxLength="17" runat="server" Text='<%# Bind("PARENT_ROLE_ID") %>' />
          <asp:CompareValidator ID="CompareValidator1" runat="server" ErrorMessage="不可與角色代號相同" ControlToValidate="txtPARENT_ROLE_ID" ControlToCompare="txtROLE_ID_G" ValidationGroup="EDIT" Operator="NotEqual" ForeColor="Red" SetFocusOnError="true"></asp:CompareValidator>
        </td>

      </tr>
    </EditItemTemplate>
    <EmptyDataTemplate>
      <table id="Table1" runat="server" style="background-color: #FFFFFF; border-collapse: collapse; border-color: #999999; border-style: none; border-width: 1px;">
        <tr>
          <td>未傳回資料。</td>
        </tr>
      </table>
    </EmptyDataTemplate>
    <InsertItemTemplate>
      <tr style="">
        <td>
          <asp:Button ID="btn_save" runat="server" CommandName="Insert" Text="新增" ValidationGroup="INSERT" />
          <asp:Button ID="btn_cancel" runat="server" CommandName="Cancel" Text="清除" />
        </td>
        <td>
          <asp:TextBox ID="txtROLE_ID_G" runat="server" MaxLength="17" Text='<%# Bind("ROLE_ID") %>' ViewStateMode="Enabled" />
          <asp:RequiredFieldValidator ID="RequiredFieldValidator1" ValidationGroup="INSERT" ControlToValidate="txtROLE_ID_G" runat="server" SetFocusOnError="true" ForeColor="Red" ErrorMessage="不可空白"></asp:RequiredFieldValidator>
        </td>
        <td>
          <asp:TextBox ID="txtROLE_NAME_G" runat="server" MaxLength="30" Text='<%# Bind("ROLE_NAME") %>' />
          <asp:RequiredFieldValidator ID="RequiredFieldValidator2" ValidationGroup="INSERT" ControlToValidate="txtROLE_NAME_G" runat="server" SetFocusOnError="true" ForeColor="Red" ErrorMessage="不可空白"></asp:RequiredFieldValidator>
        </td>
        <td>
          <asp:TextBox ID="txtPARENT_ROLE_ID" runat="server" MaxLength="17" Text='<%# Bind("PARENT_ROLE_ID") %>' />
          <asp:CompareValidator ID="CompareValidator1" runat="server" ErrorMessage="不可與ROLE ID相同" ControlToValidate="txtPARENT_ROLE_ID" ControlToCompare="txtROLE_ID_G" ValidationGroup="INSERT" Operator="NotEqual" ForeColor="Red" SetFocusOnError="true"></asp:CompareValidator>
        </td>

      </tr>
    </InsertItemTemplate>
    <ItemTemplate>
      <tr style="background-color: #FFFBD6; color: #333333;">
        <td>
          <asp:Button ID="btn_delete" runat="server" CommandName="Delete" Text="刪除" OnClientClick="if (!confirm('資料確定刪除？')){return false;}" />
          <asp:Button ID="btn_edit" runat="server" CommandName="Edit" Text="存檔" />
        </td>
        <td>
          <asp:Label ID="lblROLE_ID" runat="server" Text='<%# Eval("ROLE_ID") %>' />
        </td>
        <td>
          <asp:Label ID="lblROLE_NAME" runat="server" Text='<%# Eval("ROLE_NAME") %>' />
        </td>
        <td>
          <asp:Label ID="lblPARENT_ROLE_ID" runat="server" Text='<%# Eval("PARENT_ROLE_ID") %>' />
        </td>

      </tr>
    </ItemTemplate>
    <LayoutTemplate>
      <table id="Table2" runat="server">
        <tr id="Tr1" runat="server">
          <td id="Td1" runat="server">
            <table id="itemPlaceholderContainer" runat="server" border="1" style="background-color: #FFFFFF; border-collapse: collapse; border-color: #999999; border-style: none; border-width: 1px; font-family: Verdana, Arial, Helvetica, sans-serif; width: 950px;">
              <tr id="Tr2" runat="server" style="background-color: #FFFBD6; color: #333333;">
                <th id="Th1" runat="server"></th>
                <th id="Th2" runat="server">角色代號</th>
                <th id="Th3" runat="server">角色名稱</th>
                <th id="Th4" runat="server">上層角色代號</th>

              </tr>
              <tr id="itemPlaceholder" runat="server">
              </tr>
            </table>
          </td>
        </tr>
        <tr id="Tr3" runat="server">
          <td id="Td2" runat="server" style="text-align: center; background-color: #FFCC66; font-family: Verdana, Arial, Helvetica, sans-serif; color: #333333;">
            <asp:DataPager ID="DataPager1" runat="server" PagedControlID="DV1" PageSize="10" Visible="false">
              <Fields>
                <asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" ShowLastPageButton="True" FirstPageText="第一頁" LastPageText="最後一頁" NextPageText="下一頁" PreviousPageText="上一頁" />
              </Fields>
            </asp:DataPager>
          </td>
        </tr>
      </table>
    </LayoutTemplate>

  </asp:ListView>
  <br />
</asp:Content>

